<template>
  <div id="app">
    <el-card body-style="padding:20px 150px">
      <h3 class="button">&nbsp;小伙伴们</h3>
      <div class="MaxDiv">
        <a v-for="item in Friends" :key="item" :href="item.userFriendsUrl" target="_Blank">
          <div class="friend">
            <div class="hover"></div>
            <div class="divider">
              <p class="Name">{{ item.userFriendsName }}</p>
              <p class="NameTitle">{{ item.userStatus }}</p>
            </div>
            <div>
              <el-avatar :size="90" class="avatar"
                         :src="item.userImg"></el-avatar>
            </div>
          </div>
        </a>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "Friend",
  data() {
    return {
      Friends: {},
    }
  },
  created() {
    this.getFriends();
  },
  methods: {
    getFriends() {
      this.$axios.post('/friends/getFiends').then((res) => {
        if (res.data.success) {
          this.Friends = res.data.data;
        }
      })
    },
  },
}
</script>

<style scoped>
.hover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1000;
  background: linear-gradient(125deg, white 5%, #FE9600);

}

.button {
  border-left: solid 5px #FE9600;
}

.MaxDiv {
  margin-left: 50px;
  display: flex;
  flex-wrap: wrap;
}

.friend:hover {
  opacity: 0.99;

}

.friend:hover .avatar {
  animation: avatarAn 500ms ease-out;
}

@keyframes avatarAn {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.friend:hover .hover {
  width: 100%;
  background-color: #BA525A;
  animation: title 500ms ease-out;
}

@keyframes title {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

a {
  flex: 33.3%;
  text-align: center;
  text-decoration: none;
}

.divider {
  flex: 2;
}

.NameTitle {
  font-weight: 600;
  color: #B8BBB5;
  font-size: 10px;
}

.Name {
  font-weight: bold;
  border-bottom: solid 0.5px #cccccc;
  color: #FE9600;
  padding-bottom: 10px;
}


.friend {
  margin: 10px 0;
  position: relative;
  padding: 0 20px;
  width: 250px;
  border: solid 1px #ECECEC;
  border-radius: 12px;
}

.friend {
  display: flex;
}
</style>